package com.bdqn.crm.controller;

import com.bdqn.crm.pojo.Pagee;
import com.bdqn.crm.pojo.Storage;
import com.bdqn.crm.service.StorageService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;

@Controller
public class StorageContorller {
    @Resource
    private StorageService storageService;

    @RequestMapping(value = "storage/list")
    public String storage(Model model, @RequestParam(value = "prodName",required = false) String prodName,
                          @RequestParam(value = "stkWarehouse",required = false)String stkWarehouse,
                          @RequestParam(value = "pageIndex",defaultValue = "1") int pageIndex){
        //数据回显
        model.addAttribute("prodName",prodName);
        model.addAttribute("stkWarehouse",stkWarehouse);

        Pagee<Storage> pagee = storageService.pagee(prodName,stkWarehouse,pageIndex);
        model.addAttribute("storagePage",pagee);
        return "storage/list";
    }
}
